package twoD.Csg;

import inf.jlinalg.IVector;

public class Circle extends Primitive {

	private double cx, cy;
	private double r;

	public Circle(double cx, double cy, double r) {
		this.cx = cx;
		this.cy = cy;
		this.r = r;
	}

	public double[] getCenter() {
		return getTransformation().multiply(new double[] { cx, cy });
	}

	@Override
	public boolean contain(double...p) {
		IVector phat = getInverseLocation(p);
		return ((Math.pow(phat.get(0) - cx, 2) + Math.pow(phat.get(1) - cy, 2)) - Math
				.pow(r, 2)) <= TOL;
	}

}
